package errors

import (
	"net/http"

	"temp/constant"

	"github.com/gin-gonic/gin"
)

func HandlerError(c *gin.Context, err error) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.CommonErrorBase,
		Msg:  err.Error(),
	})
}

func HandlerParamError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.CommonErrorBase,
		Msg:  "参数异常",
	})

}

func HandlerAuthError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.Unauthorized,
		Msg:  constant.GetErrorMsg(constant.Unauthorized),
	})
}
func HandlerNotFound(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.NotFound,
		Msg:  constant.GetErrorMsg(constant.NotFound),
	})
}
func HandlerLoginError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.InvalidPassword,
		Msg:  constant.GetErrorMsg(constant.InvalidPassword),
	})
}
func HandlerRegisterError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.UserAlreadyExists,
		Msg:  constant.GetErrorMsg(constant.UserAlreadyExists),
	})
}
func HandlerUpdateError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.UserAlreadyExists,
		Msg:  constant.GetErrorMsg(constant.UserAlreadyExists),
	})
}
func HandlerDeleteError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.UserAlreadyExists,
		Msg:  constant.GetErrorMsg(constant.UserAlreadyExists),
	})
}
func HandlerListError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.UserAlreadyExists,
		Msg:  constant.GetErrorMsg(constant.UserAlreadyExists),
	})
}
func HandlerCreateUserError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.UserAlreadyExists,
		Msg:  constant.GetErrorMsg(constant.UserAlreadyExists),
	})
}
func HandlerRolesError(c *gin.Context) {
	c.JSON(http.StatusOK, constant.Response{
		Code: constant.UserAlreadyExists,
		Msg:  constant.GetErrorMsg(constant.UserAlreadyExists),
	})
}
